<template>
  <div>
    <div class="add-form">
      <div class="add-from-name">
        <div class="add-form-tit"><span style="color: #E40922;">*</span>班次名称：</div>
        <a-input v-model="editData.shiftName" class="add-from-input" placeholder="请输入"></a-input>
      </div>
      <div class="add-from-name">
        <div class="">设为默认班次：</div>
        <a-switch default-checked @change="switchShiftDefault" />
      </div>
    </div>
    <div class="add-form-other">
      <div class="add-form-tit"><span style="color: #E40922;">*</span>上班班次数：</div>
      <a-radio-group v-model="addList">
        <a-radio :value="1">1次上下班</a-radio>
        <a-radio :value="2">2次上下班</a-radio>
        <a-radio :value="3">3次上下班</a-radio>
      </a-radio-group>
    </div>

    <div v-for="(item,index) in addList" :key="index">
      <div class="add-form-other">
        <div class="add-form-tit"></div>
        <div v-if="index == 0" class="time-tit">第一次上下班时间</div>
        <div v-if="index == 1" class="time-tit">第二次上下班时间</div>
        <div v-if="index == 2" class="time-tit">第三次上下班时间</div>
      </div>
      <!-- workOneParams -->
      <template v-if="index == 0">
        <div class="add-from-picker">
          <div class="add-form-other">
            <div class="add-form-tit"></div>
            <div class="add-form-tit"><span style="color: #E40922;">*</span>上班时间：</div>
            <a-time-picker :value="moment(workOneParams.workStart, 'HH:mm')"
              :default-open-value="moment('00:00', 'HH:mm')" format="HH:mm" placeholder="请选择"
              @change="workStartOneChange" />
          </div>
          <div class="add-from-time">
            <div class="">晚到超过</div>
            <a-input v-model="workOneParams.workStartLate" class="add-from-time-input" placeholder="请输入"></a-input>
            <div class="">分钟记为迟到</div>
          </div>
        </div>
        <div class="add-from-picker">
          <div class="add-form-other"></div>
          <div class="add-from-time">
            <div class="">晚到超过</div>
            <a-input v-model="workOneParams.workStartAbsenteeism" class="add-from-time-input" placeholder="请输入">
            </a-input>
            <div class="">分钟记为旷工</div>
          </div>
        </div>
        <div class="add-from-picker">
          <div class="add-form-other"></div>
          <div class="add-from-time">
            <div class="">最早可提前</div>
            <a-input v-model="workOneParams.workStartPunch" class="add-from-time-input" placeholder="请输入"></a-input>
            <div class="">分钟进行打卡</div>
          </div>
        </div>
        <div class="add-from-picker">
          <div class="add-form-other">
            <div class="add-form-tit"></div>
            <div class="add-form-tit"><span style="color: #E40922;">*</span>下班时间：</div>
            <a-time-picker :value="moment(workOneParams.workEnd, 'HH:mm')"
              :default-open-value="moment('00:00', 'HH:mm')" format="HH:mm" placeholder="请选择"
              @change="workEndOneChange" />
          </div>
          <div class="add-from-time">
            <div class="">早走</div>
            <a-input v-model="workOneParams.workEndLeaveEarly" class="add-from-time-input" placeholder="请输入">
            </a-input>
            <div class="">分钟记为早退</div>
          </div>
        </div>
        <div class="add-from-picker">
          <div class="add-form-other"></div>
          <div class="add-from-time">
            <div class="">早走</div>
            <a-input v-model="workOneParams.workEndAbsenteeism" class="add-from-time-input" placeholder="请输入">
            </a-input>
            <div class="">分钟记为旷工</div>
          </div>
        </div>
      </template>

      <!-- workTwoParams -->
      <template v-if="index == 1">
        <div class="add-from-picker">
          <div class="add-form-other">
            <div class="add-form-tit"></div>
            <div class="add-form-tit"><span style="color: #E40922;">*</span>上班时间：</div>
            <a-time-picker :value="moment(workTwoParams.workStart, 'HH:mm')"
              :default-open-value="moment('00:00', 'HH:mm')" format="HH:mm" placeholder="请选择"
              @change="workStartTwoChange" />
          </div>
          <div class="add-from-time">
            <div class="">晚到超过</div>
            <a-input v-model="workTwoParams.workStartLate" class="add-from-time-input" placeholder="请输入"></a-input>
            <div class="">分钟记为迟到</div>
          </div>
        </div>
        <div class="add-from-picker">
          <div class="add-form-other"></div>
          <div class="add-from-time">
            <div class="">晚到超过</div>
            <a-input v-model="workTwoParams.workStartAbsenteeism" class="add-from-time-input" placeholder="请输入">
            </a-input>
            <div class="">分钟记为旷工</div>
          </div>
        </div>
        <div class="add-from-picker">
          <div class="add-form-other"></div>
          <div class="add-from-time">
            <div class="">最早可提前</div>
            <a-input v-model="workTwoParams.workStartPunch" class="add-from-time-input" placeholder="请输入"></a-input>
            <div class="">分钟进行打卡</div>
          </div>
        </div>
        <div class="add-from-picker">
          <div class="add-form-other">
            <div class="add-form-tit"></div>
            <div class="add-form-tit"><span style="color: #E40922;">*</span>下班时间：</div>
            <a-time-picker :value="moment(workTwoParams.workEnd, 'HH:mm')"
              :default-open-value="moment('00:00', 'HH:mm')" format="HH:mm" placeholder="请选择"
              @change="workEndTwoChange" />
          </div>
          <div class="add-from-time">
            <div class="">早走</div>
            <a-input v-model="workTwoParams.workEndLeaveEarly" class="add-from-time-input" placeholder="请输入">
            </a-input>
            <div class="">分钟记为早退</div>
          </div>
        </div>
        <div class="add-from-picker">
          <div class="add-form-other"></div>
          <div class="add-from-time">
            <div class="">早走</div>
            <a-input v-model="workTwoParams.workEndAbsenteeism" class="add-from-time-input" placeholder="请输入">
            </a-input>
            <div class="">分钟记为旷工</div>
          </div>
        </div>
      </template>

      <!-- workThrParams -->
      <template v-if="index == 2">
        <div class="add-from-picker">
          <div class="add-form-other">
            <div class="add-form-tit"></div>
            <div class="add-form-tit"><span style="color: #E40922;">*</span>上班时间：</div>
            <a-time-picker :value="moment(workThrParams.workStart, 'HH:mm')"
              :default-open-value="moment('00:00', 'HH:mm')" format="HH:mm" placeholder="请选择"
              @change="workStartThrChange" />
          </div>
          <div class="add-from-time">
            <div class="">晚到超过</div>
            <a-input v-model="workThrParams.workStartLate" class="add-from-time-input" placeholder="请输入"></a-input>
            <div class="">分钟记为迟到</div>
          </div>
        </div>
        <div class="add-from-picker">
          <div class="add-form-other"></div>
          <div class="add-from-time">
            <div class="">晚到超过</div>
            <a-input v-model="workThrParams.workStartAbsenteeism" class="add-from-time-input" placeholder="请输入">
            </a-input>
            <div class="">分钟记为旷工</div>
          </div>
        </div>
        <div class="add-from-picker">
          <div class="add-form-other"></div>
          <div class="add-from-time">
            <div class="">最早可提前</div>
            <a-input v-model="workThrParams.workStartPunch" class="add-from-time-input" placeholder="请输入"></a-input>
            <div class="">分钟进行打卡</div>
          </div>
        </div>
        <div class="add-from-picker">
          <div class="add-form-other">
            <div class="add-form-tit"></div>
            <div class="add-form-tit"><span style="color: #E40922;">*</span>下班时间：</div>
            <a-time-picker :value="moment(workThrParams.workEnd, 'HH:mm')"
              :default-open-value="moment('00:00', 'HH:mm')" format="HH:mm" placeholder="请选择"
              @change="workEndThrChange" />
          </div>
          <div class="add-from-time">
            <div class="">早走</div>
            <a-input v-model="workThrParams.workEndLeaveEarly" class="add-from-time-input" placeholder="请输入">
            </a-input>
            <div class="">分钟记为早退</div>
          </div>
        </div>
        <div class="add-from-picker">
          <div class="add-form-other"></div>
          <div class="add-from-time">
            <div class="">早走</div>
            <a-input v-model="workThrParams.workEndAbsenteeism" class="add-from-time-input" placeholder="请输入">
            </a-input>
            <div class="">分钟记为旷工</div>
          </div>
        </div>
      </template>

      <div v-if="(index == 0 && addList == 2) || ((index == 0 || index == 1) && addList == 3)" class="add-line">
      </div>
    </div>

    <div v-if="addList == 1" class="add-from-picker">
      <div class="add-form-other">
        <div class="add-form-tit"><span style="color: #E40922;">*</span>休息时间：</div>
        <div class="add-form-tit">休息开始时间：</div>
        <a-time-picker :value="moment(editData.restStart, 'HH:mm')" :default-open-value="moment('00:00', 'HH:mm')"
          format="HH:mm" placeholder="请选择" @change="restStartChange" />
        <div class="add-form-tit" style="margin-left: 24px;">休息结束时间：</div>
        <a-time-picker :value="moment(editData.restEnd, 'HH:mm')" :default-open-value="moment('00:00', 'HH:mm')"
          format="HH:mm" placeholder="请选择" @change="restEndChange" />
      </div>
    </div>
    <div v-if="workHours || workMinute" class="add-from-picker">
      <div class="add-form-other">
        <div class="add-form-tit">工作时长：</div>
        <div class="add-form-tit">
          合计工作时长
          <span v-if="workHours">{{ workHours + '小时' }}</span>
          <span v-if="workMinute"> {{ workMinute + '分钟' }}</span>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
  import moment from 'moment';
  import {
    attshiftEdit,
    attshiftSave
  } from '@/api/clock'
  export default {
    name: "punchEditModule",
    props: ['editData', 'componentsName'],
    data() {
      return {
        // 更改班次弹窗选中的班次
        radioShiftRowData: {},
        // 考勤班次
        attshiftData: [], //一键设置班次列表
        shiftRes: {
          id: 0,
          shiftDay1: 0,
          shiftDay1Str: undefined,
          shiftDay2: 0,
          shiftDay2Str: undefined,
          shiftDay3: 0,
          shiftDay3Str: undefined,
          shiftDay4: 0,
          shiftDay4Str: undefined,
          shiftDay5: 0,
          shiftDay5Str: undefined,
          shiftDay6: 0,
          shiftDay6Str: undefined,
          shiftDay7: 0,
          shiftDay7Str: undefined
        },
        attshiftParams: {
          shiftName: undefined, //班次名称
          id: this.dataId,
          shiftFrequency: 1, //上班班次数，1：一次上下班，2：2次上下班，必填，大于0
          shiftDefault: 0, //是否默认班次，0：否，1：默认班次，必填，默认0
          restEnd: undefined, //休息结束时间，一次上下班时必填，格式：HH:mm:ss
          restStart: undefined, //休息开始时间，一次上下班时必填，格式：HH:mm:ss
          shiftDetailParams: [],
        }, //添加班次

        selectedRowKeys: [], // Check here to configure the default column


        poiTempArr: [],

        workHours: undefined,
        workMinute: undefined,

        workOneParams: {
          detailIndex: 1, //
          workStart: '00:00', //上班开始时间，必填，格式：HH:mm:ss
          workEnd: '00:00', //上班结束时间（下班时间），必填，格式：HH:mm:ss
          workEndAbsenteeism: 0, //早走超过X分钟记录为旷工，必填，默认30
          workEndLeaveEarly: 0, //早走超过X分钟记为早退，必填，默认0
          workStartAbsenteeism: 0, //晚到超过X分钟记录为旷工，必填，默认30
          workStartLate: 0, //晚到超过X分钟记录为迟到，必填，默认0
          workStartPunch: 0, //最早可提前X分钟进行打卡，必填，默认60
        },
        workTwoParams: {
          detailIndex: 2, //
          workStart: '00:00', //上班开始时间，必填，格式：HH:mm:ss
          workEnd: '00:00', //上班结束时间（下班时间），必填，格式：HH:mm:ss
          workEndAbsenteeism: 0, //早走超过X分钟记录为旷工，必填，默认30
          workEndLeaveEarly: 0, //早走超过X分钟记为早退，必填，默认0
          workStartAbsenteeism: 0, //晚到超过X分钟记录为旷工，必填，默认30
          workStartLate: 0, //晚到超过X分钟记录为迟到，必填，默认0
          workStartPunch: 0, //最早可提前X分钟进行打卡，必填，默认60
        },
        workThrParams: {
          detailIndex: 3, //
          workStart: '00:00', //上班开始时间，必填，格式：HH:mm:ss
          workEnd: '00:00', //上班结束时间（下班时间），必填，格式：HH:mm:ss
          workEndAbsenteeism: 0, //早走超过X分钟记录为旷工，必填，默认30
          workEndLeaveEarly: 0, //早走超过X分钟记为早退，必填，默认0
          workStartAbsenteeism: 0, //晚到超过X分钟记录为旷工，必填，默认30
          workStartLate: 0, //晚到超过X分钟记录为迟到，必填，默认0
          workStartPunch: 0, //最早可提前X分钟进行打卡，必填，默认60
        },

        // step 3
        radioAddressRowData: {},

        // selectedshiftKeys: [0, 1, 2, 3, 4],
        selectedshiftKeys: [],
        loading: false,
        memberVisible: false,
        addModal: false,
        addNum: 1,
        addList: 1,
        calendar: false,
        current: 0,
        flow: ['基本信息', '考勤班次', '考勤方式', '考勤规则'],
        formLayout: 'horizontal',
        form: this.$form.createForm(this, {
          name: 'coordinated'
        }),
        oneTimeStart: undefined, //第一次字符串
        oneTimeEnd: undefined,
        restEndTime: undefined,
        restStartTime: undefined,
        workTwoStart: undefined,
        workTwoEnd: undefined,
        workThrStart: undefined,
        workThrEnd: undefined,
      }
    },
    created() {






      // console.log('editData',this.editData);
      // attshiftParams
      if (this.editData.shiftDetailParams) {
        if (this.editData.shiftDetailParams.length == 1) {
          this.editData.restStart = moment(this.editData.restStart, 'HH:mm')
          this.editData.restEnd = moment(this.editData.restEnd, 'HH:mm')
        }
        this.workMinute = this.editData.workTime % 60
        this.workHours = parseInt(this.editData.workTime / 60)
        this.addList = this.editData.shiftFrequency || 1
        if (this.editData.shiftDetailParams[0]) {
          this.workOneParams.workStart = moment(this.editData.shiftDetailParams[0].workStart, 'HH:mm')
          this.workOneParams.workEnd = moment(this.editData.shiftDetailParams[0].workEnd, 'HH:mm')
          this.workOneParams.workEndAbsenteeism = this.editData.shiftDetailParams[0].workEndAbsenteeism
          this.workOneParams.workEndLeaveEarly = this.editData.shiftDetailParams[0].workEndLeaveEarly
          this.workOneParams.workStartAbsenteeism = this.editData.shiftDetailParams[0].workStartAbsenteeism
          this.workOneParams.workStartLate = this.editData.shiftDetailParams[0].workStartLate
          this.workOneParams.workStartPunch = this.editData.shiftDetailParams[0].workStartPunch
          this.workOneParams.shiftId = this.editData.shiftDetailParams[0].shiftId
          this.workOneParams.id = this.editData.shiftDetailParams[0].id
        }
        if (this.editData.shiftDetailParams[1]) {
          this.workTwoParams.workStart = moment(this.editData.shiftDetailParams[1].workStart, 'HH:mm')
          this.workTwoParams.workEnd = moment(this.editData.shiftDetailParams[1].workEnd, 'HH:mm')
          this.workTwoParams.workEndAbsenteeism = this.editData.shiftDetailParams[1].workEndAbsenteeism
          this.workTwoParams.workEndLeaveEarly = this.editData.shiftDetailParams[1].workEndLeaveEarly
          this.workTwoParams.workStartAbsenteeism = this.editData.shiftDetailParams[1].workStartAbsenteeism
          this.workTwoParams.workStartLate = this.editData.shiftDetailParams[1].workStartLate
          this.workTwoParams.workStartPunch = this.editData.shiftDetailParams[1].workStartPunch
          this.workOneParams.shiftId = this.editData.shiftDetailParams[1].shiftId
          this.workOneParams.id = this.editData.shiftDetailParams[1].id
        }
        if (this.editData.shiftDetailParams[2]) {
          this.workThrParams.workStart = moment(this.editData.shiftDetailParams[2].workStart, 'HH:mm')
          this.workThrParams.workEnd = moment(this.editData.shiftDetailParams[2].workEnd, 'HH:mm')
          this.workThrParams.workEndAbsenteeism = this.editData.shiftDetailParams[2].workEndAbsenteeism
          this.workThrParams.workEndLeaveEarly = this.editData.shiftDetailParams[2].workEndLeaveEarly
          this.workThrParams.workStartAbsenteeism = this.editData.shiftDetailParams[2].workStartAbsenteeism
          this.workThrParams.workStartLate = this.editData.shiftDetailParams[2].workStartLate
          this.workThrParams.workStartPunch = this.editData.shiftDetailParams[2].workStartPunch
          this.workOneParams.shiftId = this.editData.shiftDetailParams[2].shiftId
          this.workOneParams.id = this.editData.shiftDetailParams[2].id
        }
      } else {
        this.editData.restStart = '00:00'
        this.editData.restEnd = '00:00'
      }
    },
    methods: {




      handleSubmit(e) {
        e.preventDefault();
        this.form.validateFields((err, values) => {
          if (!err) {
            console.log('Received values of form: ', values);
          }
        });
      },
      moment,
      handleSelectChange(value) {
        console.log(value);
        this.form.setFieldsValue({
          note: `Hi, ${value === 'male' ? 'man' : 'lady'}!`,
        });
      },
      switchShiftDefault(e) {
        this.attshiftParams.shiftDefault = e ? 1 : 0
      },
      onExpand(expandedKeys) {
        console.log('onExpand', expandedKeys);
        // if not set autoExpandParent to false, if children expanded, parent can not collapse.
        // or, you can remove all expanded children keys.
        this.expandedKeys = expandedKeys;
        this.autoExpandParent = false;
      },
      onSelect(selectedKeys, info) {
        console.log('onSelect', info);
        this.selectedKeys = selectedKeys;
      },
      keyForm() {
        this.keyDialog = true
      },
      memberListChange(memberList) {
        this.memberList = memberList;
      },
      leaderListChange(leaderList) {
        this.leaderList = leaderList;
      },







      workStartOneChange(time, timeString) {
        this.workOneParams.workStart = time
        this.oneTimeStart = timeString
        this.oneTime(this.oneTimeStart, this.oneTimeEnd, undefined, undefined)
      },
      workEndOneChange(time, timeString) {
        this.workOneParams.workEnd = time
        this.oneTimeEnd = timeString
        this.oneTime(this.oneTimeStart, this.oneTimeEnd, undefined, undefined)
      },
      workStartTwoChange(time, timeString) {
        this.workTwoParams.workStart = time
        this.workTwoStart = timeString
        // this.oneTime(this.workTwoParams.workStart, this.workTwoParams.workEnd, undefined, undefined)

        this.restTime()
      },
      workEndTwoChange(time, timeString) {
        this.workTwoParams.workEnd = time
        this.workTwoEnd = timeString
        // this.oneTime(this.workTwoParams.workStart, this.workTwoParams.workEnd, undefined, undefined)

        this.restTime()
      },
      workStartThrChange(time, timeString) {
        this.workThrParams.workStart = time
        this.workThrStart = timeString
        // this.oneTime(this.workThrParams.workStart, this.workThrParams.workEnd, undefined, undefined)

        this.restTime()
      },
      workEndThrChange(time, timeString) {
        this.workThrParams.workEnd = time
        this.workThrEnd = timeString
        // this.oneTime(this.workThrParams.workStart, this.workThrParams.workEnd, undefined, undefined)
        this.restTime()
      },

      // 多班次工作时间计算
      restTime() {

        console.log("this.oneTimeStart: ", this.oneTimeStart);
        console.log("this.oneTimeEnd: ", this.oneTimeEnd);

        console.log("this.workTwoStart: ", this.workTwoStart);
        console.log("this.workTwoEnd: ", this.workTwoEnd);

        console.log("this.workThrStart: ", this.workThrStart);
        console.log("this.workThrEnd: ", this.workThrEnd);


        let cdate = new Date()
        let cday = cdate.getFullYear() + '-' + (cdate.getMonth() + 1) + '-' + cdate.getDate()
        let oneRestTime = ''
        if (this.workOneParams.workEnd != '00:00') {
          let workStart = cday + ' ' + this.oneTimeStart
          let workEnd = cday + ' ' + this.oneTimeEnd
          oneRestTime = new Date(workEnd).valueOf() - new Date(workStart).valueOf()
        }
        let twoRestTime = ''
        if (this.workTwoParams.workEnd != '00:00') {
          let workStart = cday + ' ' + this.workTwoStart
          let workEnd = cday + ' ' + this.workTwoEnd
          twoRestTime = new Date(workEnd).valueOf() - new Date(workStart).valueOf()
        }
        let thrRestTime = ''
        if (this.workThrParams.workEnd != '00:00') {
          let workStart = cday + ' ' + this.workThrStart
          let workEnd = cday + ' ' + this.workThrEnd
          thrRestTime = new Date(workEnd).valueOf() - new Date(workStart).valueOf()
        }
        if (oneRestTime < 0 || twoRestTime < 0 || thrRestTime < 0) {
          return this.$message.error('计算时长出现负数，请合理选择工作时间！');
        }
        let allRestTime = oneRestTime + twoRestTime + thrRestTime
        console.log("allRestTime: ", allRestTime);
        this.workHours = parseInt((allRestTime % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
        this.workMinute = parseInt((allRestTime % (1000 * 60 * 60)) / (1000 * 60));
      },

      oneTime(workStart, workEnd, restStart, restEnd) {
        try {
          let cdate = new Date()
          let cday = cdate.getFullYear() + '-' + (cdate.getMonth() + 1) + '-' + cdate.getDate()
          if (workStart) workStart = cday + ' ' + workStart
          if (workEnd) workEnd = cday + ' ' + workEnd
          if (restStart) restStart = cday + ' ' + restStart
          if (restEnd) restEnd = cday + ' ' + restEnd
          if (workStart && workEnd) {
            let mss
            // 有休息时间
            if (restStart && restEnd) {
              mss = new Date(workEnd).valueOf() - new Date(workStart).valueOf() - (new Date(restEnd).valueOf() -
                new Date(restStart).valueOf())
            } else {
              mss = new Date(workEnd).valueOf() - new Date(workStart).valueOf()
            }
            if (mss < 0) {
              return this.$message.error('计算时长出现负数，请合理选择工作时间！');
            }
            this.workHours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
            this.workMinute = parseInt((mss % (1000 * 60 * 60)) / (1000 * 60));
          }
        } catch (e) {
          console.log("又报错: ", e);
        }


      },
      restStartChange(time, timeString) {
        this.restStartTime = timeString
        this.attshiftParams.restStart = time
        this.editData.restStart = time
        console.log('this.editData.restStart', this.editData.restStart);
        this.oneTime(this.oneTimeStart, this.oneTimeEnd, this.restStartTime, this.restEndTime)
      },
      restEndChange(time, timeString) {
        this.restEndTime = timeString
        this.attshiftParams.restEnd = time
        this.editData.restEnd = time
        this.oneTime(this.oneTimeStart, this.oneTimeEnd, this.restStartTime, this.restEndTime)
      },
      handleaddModalOk() {
        this.attshiftParams.shiftName = []
        this.attshiftParams.shiftName = this.editData.shiftName
        console.log('this.editData.shiftName', this.editData.shiftName);
        this.attshiftParams.id = this.editData.id
        this.attshiftParams.shiftFrequency = this.addList
        if (this.editData.restEnd) {
          this.attshiftParams.restEnd = moment(this.editData.restEnd).format('HH:mm')
          this.attshiftParams.restStart = moment(this.editData.restStart).format('HH:mm')
        }
        this.workOneParams.workEnd = moment(this.workOneParams.workEnd).format('HH:mm')
        this.workOneParams.workStart = moment(this.workOneParams.workStart).format('HH:mm')
        this.attshiftParams.shiftDetailParams.push(this.workOneParams)
        if (this.addList > 1) {
          this.attshiftParams.shiftDetailParams.push(this.workTwoParams)
        }
        if (this.addList > 2) {
          this.attshiftParams.shiftDetailParams.push(this.workThrParams)
        }
        if (this.componentsName == '添加班次') {
          if (this.addList > 1) {
            this.attshiftParams.restEnd = undefined
            this.attshiftParams.restStart = undefined
          }
          if (this.addList == 2) {
            this.workTwoParams.workStart = this.workTwoStart
            this.workTwoParams.workEnd = this.workTwoEnd
          }
          if (this.addList == 3) {
            this.workTwoParams.workStart = this.workTwoStart
            this.workTwoParams.workEnd = this.workTwoEnd
            this.workThrParams.workStart = this.workThrStart
            this.workThrParams.workEnd = this.workThrEnd
          }
          console.log('attshiftParams', this.attshiftParams);
          attshiftSave(this.attshiftParams).then(response => {
              this.$message.success('添加班次');
            })
            .catch(() => {

            })
        } else {

          attshiftEdit(this.attshiftParams).then(response => {
              this.$message.success('修改成功');
            })
            .catch(() => {

            })
        }

      },
    },
    mounted() {



    }
  }
</script>

<style lang="less" scoped="scoped">
  .add-form {
    display: flex;
    align-items: center;
    justify-content: space-between;

    .add-from-name {
      display: flex;
      align-items: center;

      .add-form-tit {
        width: 90px;
        text-align: right;
        white-space: nowrap;
      }

      .add-from-input {
        width: 570px;
      }
    }
  }

  .add-form-other {
    display: flex;
    align-items: center;
    margin-top: 24px;

    .add-form-tit {
      width: 90px;
      text-align: right;
      white-space: nowrap;
    }

    .time-tit {
      font-size: 14px;
      font-weight: 600;
      color: #333333;
      margin-top: 8px;
    }
  }

  .add-from-picker {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 660px;

    .add-from-time {
      display: flex;
      align-items: center;
      margin-top: 24px;

      .add-from-time-input {
        width: 120px;
        margin: 0 5px;
      }
    }
  }

  .add-line {
    height: 1px;
    background: #E5E5E5;
    margin-left: 90px;
    margin-top: 32px;
  }
</style>
